#include<stdio.h>
#include<string.h>

int main()
{
	char a[10000];
	int count, right, left;
	int max = 1; 
	int k = 0;
	
	gets(a);
	int len = strlen(a);
	for(int i = 0; a[i] != '\0'; i++)
	{
		count = 1;
		left = i - 1;
		right = i + 1;
		while(left >= 0&&right <= len)
		{
			if(a[left] == a[right])
			{
				count = count + 2;
			}
			else
			{
				break;
			}
			left--;
			right++;
		}
		if(count > max)
		{
			max = count;
		}
	}
	
	for(int i = 0; a[i] != '\0'; i++)
	{
		count = 0;
		left = i;
		right = i + 1;
		while(left >= 0&&right <= len)
		{
			if(a[left] == a[right])
			{
				count = count + 2;
			}
			else
			{
				break;
			}
			left--;
			right++;
		}
		if(count > max)
		{
			max = count;
		}
	}
	printf("%d",max);

	return 0;
}
